/*
   gpuGard.h

   Created by Miroslav Karpis on 1/12/11.
   Copyright 2011 Miroslav Karpis. All rights reserved.

   This file is part of molecEvol.

   molecEvol is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   Foobar is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef GPUGARD_H
#define GPUGARD_H

#include <OpenCL/opencl.h>

#ifdef __APPLE__

#include <OpenCL/cl.h>
#include <OpenCL/cl_gl.h>
#include <OpenCL/cl_gl_ext.h>
#include <OpenCL/cl_ext.h>

#else

#include <CL/cl.h>
#include <CL/cl_gl.h>
#include <CL/cl_gl_ext.h>
#include <CL/cl_ext.h>

#endif

#include <iostream>
#include <fstream>
#include <sstream>
#include <math.h>
#include <assert.h>

using namespace std;

struct assembly{
    cl_uint assemblyID;
    cl_uint molecules [100];
};

class gpuGard
{
public:
    gpuGard();

    //! creates moleculat population. Returnes 2D vector of molecTypes and their seed
    void initGard(cl_uint nMolecTypes, float *Bij);

    //! returns random number generated based on log normal distribution equation
    //! normal random variate generator mean m, standard deviation s
    float rand_logNormal(float mean, float variance);

    //all the logic behind one simulation time-step of GARD
    bool runGard(float *Bij);

    assembly gardAssemb;

private:
    float mean;
    float sigma;
    float Kf;
    float Kb;
    float pi;
    float gardPi;
    cl_uint Ng;
    cl_uint Nmax;

    float euler;

};

#endif // GPUGARD_H
